package Controls
{
	import Objects.GameBitmap;
	import Objects.GameObject;
	import Objects.GameSprite;
	
	import Setup.ZOrder;

	public class Panel extends GameSprite
	{
		private var mask:GameObject;
		public var back:GameBitmap;
		public var maskClass:Class;
		public function Panel()
		{
			super();
			
			intelligent=true;
			statistical=true;

			maskClass=ModalMask;
			
			back=new Image();
			addChild(back);
		}
		public final function born(modal:Boolean=true,zOrder:String=""):void
		{
			if(!zOrder)
			{
				zOrder=ZOrder.PANEL;
			}
			if(modal)
			{
				mask=new maskClass();
				gs.addGameObject(mask,zOrder);
			}
			gs.addGameObject(this,zOrder);
			_born();
		}
		protected function _born():void
		{
			
		}
		override protected function $remove():void
		{
			if(mask)
			{
				mask.remove();
			}
		}
	}
}